﻿namespace ScrumLite.WebUx.Tests
{
    using System;
    using System.Configuration;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using ScrumLite.Services;
    using ScrumLite.Services.Contracts;
    using ScrumLite.WebUx.Controllers;
    using ScrumLite.WebUx.Models;
    using System.Web.Mvc;


    /// <summary>
    /// Summary description for MeasuresControllerFixture
    /// </summary>
    [TestClass]
    public class MeasuresControllerFixture
    {
        [TestMethod]
        public void ShouldGetMeasuresByProcessName()
        {
            TestableMeasuresController controller = new TestableMeasuresController();
            MockHelpers.SetupMocks(controller);

            controller.Dashboard("AF06A611-12CE-4C06-B3AD-E2754D12D516", "DSAM");

            Assert.AreEqual(2, ((MeasuresListViewData)controller.Data).Measures.Count);
        }
    }

    class TestableMeasuresController : MeasuresController
    {
        public object Data;

        public TestableMeasuresController()
            : base(new MockMeasuresService(), new MockProjectsService())
        {
        }

        protected override void RenderView(string viewName, string masterName, object viewData)
        {
            Data = viewData;
        }
    }
}
